//
//  FFFTabBarController.m
//  OneDiscountMall
//
//  Created by 樊凡凡 on 16/3/29.
//  Copyright © 2016年 樊凡凡. All rights reserved.
//http://jkjby.repaiapp.com/jkjby/view/tmzk_api.php?

#import "FFFTabBarController.h"
#import "FFFTabBar.h"
#import "FFFBrandController.h"
#import "FFFHomeController.h"
#import "FFFNavigationController.h"
#import "FFFPersonalController.h"
#import "FFFValueController.h"
#import "FFFBoutiqueController.h"


@interface FFFTabBarController ()

@end

@implementation FFFTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
//    FFFTabBar *tabBar=[[FFFTabBar alloc]init];
//    [self setValue:tabBar forKey:@"tabBar"];
    
    FFFHomeController *homeVc=[[FFFHomeController alloc]init];
    [self createChildViewController:homeVc selectedImage:@"tab_home"];
    FFFBrandController *brandVc=[[FFFBrandController alloc]init];
    [self createChildViewController:brandVc selectedImage:@"tab_brand"];
    FFFValueController *valueVc=[[FFFValueController alloc]init];
    [self createChildViewController:valueVc selectedImage:@"tab_value"];
    FFFBoutiqueController *boutiqueVc=[[FFFBoutiqueController alloc]init];
    [self createChildViewController:boutiqueVc selectedImage:@"tab_boutique"];
    
    UIStoryboard *storyBoard=[UIStoryboard storyboardWithName:@"Personal" bundle:nil];
    FFFPersonalController *personalVc=[storyBoard instantiateViewControllerWithIdentifier:@"personal"];
    [self createChildViewController:personalVc selectedImage:@"tab_personal"];
}
-(void)createChildViewController:(UIViewController *)controller selectedImage:(NSString *)img
{
    UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:controller];
    
    NSString *image=[NSString stringWithFormat:@"%@_dis",img];
    UIImage *normalImage=[UIImage imageNamed:image];
    
    UIImage *selectedImg=[UIImage imageNamed:img];
    nav.tabBarItem.image=normalImage;
    nav.tabBarItem.selectedImage=selectedImg;
    [self addChildViewController:nav];
}
@end
